__author__ = 'Serprutiy'


my_text = '<?xml version="1.0" encoding="UTF-8"?><result><message>error</message><errors><error>Sendcloud has exception : 553 template_validate not match, reason:unequal image content:md5 mot match</error></errors></result>'

if my_text.find('success') != -1:
    err_msg = 'success'
elif my_text.find('<errors>') != -1:
    begin_index = my_text.find('<errors>') + len('<errors>')
    end_index = my_text.find('</errors>')
    err_msg = my_text[begin_index: end_index]
else:
    err_msg = 'ok'

print(err_msg)
